package com.dashu.core.result;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 返回T类型的对象 eg. {"code":1,"message":"SUCCESS","data":{"id":2000,"name":"admin"}}
 */
@Data
public class ResultBean<T> {
    @ApiModelProperty(value = "状态", required = true)
    private Integer code;
    @ApiModelProperty(value = "状态消息", required = true)
    private String message;
    @ApiModelProperty(value = "内容", required = true)
    private T data = null;

    public ResultBean(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public ResultBean() {
        super();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    @Override
    public String toString() {
        return "ResultBean{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
